<?php

namespace App\Admin\Actions\Player;

use App\Admin\Forms\ImportPlayerForm;
use App\Models\Chapter;
use Dcat\Admin\Grid\Tools\AbstractTool;
use Dcat\Admin\Widgets\Modal;

class BatchUpload extends AbstractTool
{
    protected string $title = '批量上传';

    public function __construct(protected Chapter $chapter)
    {
        parent::__construct($this->title);
    }

    public function render(): string
    {
        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body(ImportPlayerForm::make()->payload(['chapter_id' => $this->chapter->getKey()]))
            ->button('<button class="btn btn-outline-success waves-effect">'.$this->title.'</button>')
            ->render();
    }
}
